use ash::vk;

use crate::{system::MAX_FRAMES_IN_FLIGHT, vulkan::{vk_context, VkContext}, VK_CHECK_UNSAFE};

use super::{RenderSystem, FrameSyncObject};

impl RenderSystem {
    /// 构造渲染所需的同步量
    pub fn create_sync_objects(vk_context: &VkContext) -> Vec<FrameSyncObject> {
        let mut frame_sync_objects = vec![];

        for _index in 0..MAX_FRAMES_IN_FLIGHT {
            frame_sync_objects.push(
                FrameSyncObject {
                    image_available_semaphore   : vk_context.create_semaphore(),
                    render_finished_semaphore   : vk_context.create_semaphore(),
                    submit_fence                : vk_context.create_fence()
                }
            )
        };

        frame_sync_objects
    }
}